using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

/**
*@file       DBRole_EnterSender.cs
*@brief      send message DBRole_Enter
*
*@author     graywind
*@version    1.0.0.1
*@data       2012/3/26
*/

//send message DBRole_Enter
public class msgDBRole_Enter
{
    public const int MessageId = (int)DBServerTypes.MessageType.DBRole_Enter;
    //TODO
	public int SessionId = NetLib.INVALID_SESSION;
	public dbserver.DBRoleEnter MsgContent = new dbserver.DBRoleEnter();
	/// <summary>
	/// Initializes a new instance of the <see cref="msgDBRole_Enter"/> class.
	/// </summary>
	/// <param name='session_id'>
	/// Session_id.
	/// </param>
	/// <param name='role_enter'>
	/// Role_enter.
	/// </param>
	public msgDBRole_Enter(int session_id, gameserver.RoleEnter role_enter)
	{
		SessionId = session_id;
		MsgContent.GateCode = role_enter.GateCode;
		MsgContent.RoleCode = role_enter.RoleCode;
		MsgContent.UsrId = role_enter.UsrId;
		MsgContent.UsrName = role_enter.UsrName;
		MsgContent.WorldId = role_enter.WorldId;
	}
}

//handle message
public partial class gwMessagePort
{
    /// <summary>
    /// handle message
    /// </summary>
    /// <param name="msg">message wrapper of DBRole_Enter</param>
    public static void ProcessMessage(msgDBRole_Enter msg)
    {
        //TODO
        //Main Message:  msgDBServer
		msgDBServer mainMsg = new msgDBServer(msg.SessionId, msgDBRole_Enter.MessageId, ProtoNet<dbserver.DBRoleEnter>.IntoBytes(msg.MsgContent));
		gwMessagePort.ProcessMessage(mainMsg);
    }
}
